{% extends 'base.html' %}
{% load i18n %}
{% load sitetags%}

{% block title %}{% trans '本地登录' %}{% endblock %}

{% block body %}
<div class="container-fluid">
    <div class="d-flex align-items-center justify-content-center" style="height: 80vh;">
        <div class="card border-0 shadow-sm" style="min-width: 400px">
            {% get_website_title as site_title %}
            <div class="bg-light p-2 text-center">
                <span class="">{% trans '登录' %} {{ site_title }}</span>
            </div>
            <div class="card-body">
                {% if form.errors %}
                    <div class="text-danger">{{ form.non_field_errors }}</div>
                {% endif %}
                {% if errors %}
                    <div class="text-danger">
                        <ul>
                            {% for err in errors %}
                                <li>{{ err }}</li>
                            {% endfor %}
                        </ul>
                    </div>
                {% endif %}
                <form method="post" action="{% url 'users:local_login' %}" id="login-form">
                    {% csrf_token %}
                    <div class="input-group form-group">
                        <div class="input-group-prepend">
                            <label class="input-group-text" id="id_username" style="min-width: 80px">{% trans '用户名' %}:</label>
                        </div>
                        <input type="text" name="username" class="form-control" required id="id_username" placeholder="username">
                    </div>
                    <div class="input-group form-group">
                        <div class="input-group-prepend">
                            <label class="input-group-text" for="id_password" style="min-width: 80px">{% trans '密码' %}:</label>
                        </div>
                        <input class="form-control" type="password" name="password" required id="id_password" placeholder="password">
                    </div>
                    <div >
                        <input type="hidden" name="next" value="{{ request.GET.next }}">
                        <input type="hidden" name="this_is_the_login_form" value="1"/>
                    </div>
                    <div class="form-group">
                        <input class="btn btn-primary form-control" id="btn-submit" type="submit" value="{% trans '登录' %}">
{#                        <a class="btn text-warning" href="{% url 'users:forget' %}">忘记密码</a>#}
{#                        <a class="btn btn-outline-success float-right" onclick="alert('{% trans "暂不允许个人注册，请联系管理员" %}');return false;">{% trans '注册' %}</a>#}
                    </div>
                    {% get_aai_signin_name_url as name_url %}
                    {% if name_url %}
                        <div class="border-top">
                            <a class="btn btn-sm p-2" href="{{ name_url.url }}"><i class="fa fa-share"></i> <i class="fa fa-user"></i> {{ name_url.name }}</a>
                        </div>
                    {% endif %}
                    {% get_yunkun_auth_prividers request as auth_prividers %}
                    {% for provider in auth_prividers %}
                        <div class="border-top">
                            <a class="btn btn-sm p-2" href="{{ provider.url }}"><i class="fa fa-share"></i> <i class="fa fa-user"></i> {{ provider.name }}</a>
                        </div>
                    {% endfor %}
                </form>
            </div>
        </div>
    </div>
</div>
{% endblock %}

